import { createApp } from 'vue';

import { createPinia } from 'pinia';

import piniaPluginPersist from 'pinia-plugin-persist';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';


import directive from "./directive"

import router from './router';
import './style.css'
import App from './App.vue'
import globalModule from './view/globalModule.vue'


const app = createApp(App);
// app.use(router);
app.component("globalModule", globalModule)  // 注册全局组件

app.config.globalProperties.x = 98 // 定义全局的属性
declare module 'vue' {
    interface ComponentcustomProperties {
        x: number
    }
}
// 全局自定义指令
app.directive('beauty', (element, { value }) => {
    element.innerText += value
    element.style.color = 'green'
    element.style.backgroundColor = 'yellow'
})



const pinia = createPinia()
pinia.use(piniaPluginPersist);
pinia.use(piniaPluginPersistedstate);

app.use(directive);
app.use(pinia);
app.use(router);
app.mount('#app')
